package com.at.ynagxh.config.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RequiredArgsConstructor
@RestController
public class ChatController {

    private final ChatModel chatModel;





    @GetMapping("/call")
    public String call(@RequestParam(value = "prompt",defaultValue = "你是谁") String  prompt) {
        return chatModel.call(prompt);
    }


    @GetMapping("/stream")
    public Flux<String> stream(@RequestParam(value = "prompt",defaultValue = "你是谁") String  prompt) {
        return chatModel.stream(prompt);
    }
}
